Normative: Don't fall back to default locale in Locale.p.getCollations() - #1072
Conversation
sffc
left a comment
There was a problem hiding this comment.
This makes it more consistent with other ops like the one for numbering system. Thanks!
|
How this PR should be test. Could someone illustrate the method of testing by drafting a test262 PR? |
This is not testable in test262, because it requires setting the default locale. See #1053 (comment). |
if so, then how is this change meaningful? |
|
Suppose your browser locale is new Intl.Locale("abcdefgh").getCollations()
// Old behavior: emoji,eor,pinyin,stroke,zhuyin
// New behavior: emoji,eorThe result should not depend on the browser locale. |
|
I'd have to page the context back in as it's been a few weeks since I looked at this, but I believe there is a change to |
This is Anba's proposed change from the issue. Closes: tc39#1053
44034b3 to
668f293
Compare
|
Rebased. |
This commit provides additional coverage for the CollationsOfLocale AO, in preparation for the normative change in tc39/ecma402#1072. LLM disclosure: I used a bot to draft these tests, and hand-edited them until I was satisfied. default-locale-fallback.js is heavily commented, but I did actually remove all the LLM comment spew; what's left are my own comments.
With normative PR tc39/ecma402#1072, the unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return the root collations ["emoji", "eor"] from getCollations(). The und locales are no longer hardcoded, but it's a safe assumption that they will also return the root collations. Combine the two tests that dealt with und and unmatched locales into one.
This commit provides additional coverage for the CollationsOfLocale AO, in preparation for the normative change in tc39/ecma402#1072. LLM disclosure: I used a bot to draft these tests, and hand-edited them until I was satisfied. default-locale-fallback.js is heavily commented, but I did actually remove all the LLM comment spew; what's left are my own comments.
With normative PR tc39/ecma402#1072, the unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return the root collations ["emoji", "eor"] from getCollations(). The und locales are no longer hardcoded, but it's a safe assumption that they will also return the root collations. Combine the two tests that dealt with und and unmatched locales into one.
|
Tests in tc39/test262#5092. Note that it is indeed not possible to test the change directly. I've added a test that may or may not fail if the change is not implemented, depending on the default locale, but should always pass after the change regardless of the default locale. Testing it locally on d8, for example, it fails with |
This commit provides additional coverage for the CollationsOfLocale AO, in preparation for the normative change in tc39/ecma402#1072. LLM disclosure: I used a bot to draft these tests, and hand-edited them until I was satisfied. default-locale-fallback.js is heavily commented, but I did actually remove all the LLM comment spew; what's left are my own comments.
With normative PR tc39/ecma402#1072, the unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return the root collations ["emoji", "eor"] from getCollations(). The und locales are no longer hardcoded, but it's a safe assumption that they will also return the root collations. Combine the two tests that dealt with und and unmatched locales into one.
This commit provides additional coverage for the CollationsOfLocale AO, in preparation for the normative change in tc39/ecma402#1072. LLM disclosure: I used a bot to draft these tests, and hand-edited them until I was satisfied. default-locale-fallback.js is heavily commented, but I did actually remove all the LLM comment spew; what's left are my own comments.
With normative PR tc39/ecma402#1072, the unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return the root collations ["emoji", "eor"] from getCollations(). The und locales are no longer hardcoded, but it's a safe assumption that they will also return the root collations. Combine the two tests that dealt with und and unmatched locales into one.
This commit provides additional coverage for the CollationsOfLocale AO, in preparation for the normative change in tc39/ecma402#1072. LLM disclosure: I used a bot to draft these tests, and hand-edited them until I was satisfied. default-locale-fallback.js is heavily commented, but I did actually remove all the LLM comment spew; what's left are my own comments.
With normative PR tc39/ecma402#1072, the unmatched locales (e.g. qfz, qga-DE, etc.) are hardcoded to return the root collations ["emoji", "eor"] from getCollations(). The und locales are no longer hardcoded, but it's a safe assumption that they will also return the root collations. Combine the two tests that dealt with und and unmatched locales into one.
Bumps the pinned suite to defaaf1571cd13b183e3f505c6a06e8db316e593. Three things came in with it, and all three needed engine work to stay green. Iterator.prototype.join (https://github.com/tc39/proposal-iterator-join) is the new feature, with 18 tests. Joining is the easy half; which failures close the receiver is the part worth reading the tests for. Coercing the separator closes it, and so does coercing a value the iterator produced. An abrupt `next` lookup, a throwing `next()`, and a protocol violation (a step result that is not an object) all propagate without closing, because IteratorStepValue marks the record done first. Exhaustion does not close either. The separator is coerced *before* `next` is read, so a receiver whose `next` getter throws never gets that far, and `next` is read exactly once however many steps follow. Nullish values format as the empty string, as they do in Array.prototype.join. Intl.Locale.prototype.getCollations picked up a normative change (tc39/ecma402#1072): a tag matching no available Collator locale no longer falls back to the default locale — it reports the hardcoded root collations « "emoji", "eor" » — and the result is now sorted in lexicographic code unit order. Jint reported a single-element ["default"] for every locale, and "default" is Jint's internal placeholder for "no collation was requested", not an identifier a locale can report at all. It now reports the root collations plus whatever the language adds, sorted; an explicitly requested collation, however it was requested, is still the whole answer. The data comes from the table CollatorConstructor already kept, so nothing new was invented: "de" reports ["emoji","eor","phonebk"], "zh" its seven, "tr" and "und" and any private-use tag the bare root pair. import-defer grew IsModuleSCCEvaluated, and Jint needed it. A module that finished its own body is only really done once the strongly connected component it belongs to is: a member of an async cycle reaches EVALUATED as soon as its body returns, while the cycle root sits in EVALUATING-ASYNC awaiting a top-level await. Reading the member's own status is what GatherAsynchronousTransitiveDependencies and ReadyForSyncExecution were doing, so a deferred subgraph reaching into such a cycle looked free of async dependencies — and the deferring module ran its body, and took its deferred namespace, before the cycle had finished. The new test walks exactly that graph. ReadyForSyncExecution refuses an EVALUATED-but-not-SCC-evaluated module rather than asserting on it: the spec asserts LINKED at that point, having convinced itself the state is unreachable, and refusing is both the conservative answer and the one EvaluateSync already turns into the spec's TypeError. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This is Anba's proposed change from the issue. It would change the handling of locales with undefined languages such as
und-u-co-emojiand also remove the fallback to the default locale (soLANG=environment variables would have no effect.)Closes: #1053